import HomeList from "../pages/HomeList.vue";
import TypeList from "../pages/TypeList.vue";
import HomeOne from "../pages/HomeOne.vue";
import HomeTwo from "../pages/HomeTwo.vue";
import HomeThree from "../pages/HomeThree.vue";
import TypeOne from "../pages/TypeOne.vue";
import TypeTwo from "../pages/TypeTwo.vue";
import TypeThree from "../pages/TypeThree.vue";
import { createRouter, createWebHashHistory } from "vue-router";

const routes = [
  {
    path: "/",
    component: HomeList,
    redirect: "/home",
  },
  {
    path: "/home",
    component: HomeList,
    redirect: "/home/h1",
    children: [
      {
        path: "/home/h1",
        meta: { text: "首页1" },
        component: () => import("../pages/HomeOne.vue"),
      },
      {
        path: "/home/h2",
        meta: { text: "首页2" },
        component: () => import("../pages/HomeTwo.vue"),
      },
      {
        path: "/home/h3",
        meta: { text: "首页3" },
        component: () => import("../pages/HomeThree.vue"),
      },
    ],
  },
  {
    path: "/type",
    component: TypeList,
    redirect: "/type/t1",
    children: [
      {
        path: "/type/t1",
        component: () => import("../pages/TypeOne.vue"),
      },
      {
        path: "/type/t2",
        component: () => import("../pages/TypeTwo.vue"),
      },
      {
        path: "/type/t3",
        component: () => import("../pages/TypeThree.vue"),
      },
    ],
  },
];

const router = createRouter({
  history: createWebHashHistory(),
  routes,
});

export default router;
